#include <STC15F2K60S2.H>
#include "Timer2.h"
#include "Relay.h"
#include "Key.h"

unsigned char Key_Number;
unsigned char i = 0;
void main()
{
	Latch_Init(RELAY,0x00);
	Latch_Init(LED,0x55);
	Timer2_Init();
		for(i = 1;i <= 9;i++)
{
  Nixie_X(i,i);
}	
	while(1)
	{
	
		if(Key_Number = Key_return())
		Latch_Init(LED,Key_Number);
		
	}
}

/**********************************************************************/
//定时器2中断服务程序
/**********************************************************************/
void Timer2() interrupt 12 using 1
{
	static unsigned int He = 0;
	static unsigned int Yu = 0;
	T2L = 0xAE;		//设置定时初值
	T2H = 0xFB;		//设置定时初值
	if(2 == ++Yu)
	{
		Yu = 0;
		Nixie_Loop();
	}
	if(40 == ++He)//20毫秒
	{
		He = 0;
		Key_Loop();
	}
}
/**********************************************************************/

